<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-language" content="zh-CN" />
<title>腾讯验证码</title>
<script src="https://ssl.captcha.qq.com/TCaptcha.js"></script>
<script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
</head>
<body>
<div>
<button id="TencentCaptcha"
     data-appid="2085151417"
     data-cbfn="callback"
     type="button"
>验证</button>
</div>
<script language="javascript" type="text/javascript">
	window.callback = function(res){
	 console.log(res)
	 // res（用户主动关闭验证码）= {ret: 2, ticket: null}
	 // res（验证成功） = {ret: 0, ticket: "String", randstr: "String"}
	 if(res.ret === 0){
	     //alert(res.randstr)   // 票据
	     $.ajax({  
             type: 'POST',  
             url: 'insertQQOrder.do' ,           
             dataType: 'json',  
             contentType:'application/json;charset=UTF-8',  
             data:res,
             success:function(data){  
             	console.log(data); 
             	//window.location.reload();
             },  
             error:function(textStatus, errorThrown){  
                 console.log(textStatus);  
             }  
         });
	 }
	}
</script>
</body>






